package com.foreveross.bsl.web;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

/**
 * 菜单项类
 * @author Wangyi
 * @version v1.0
 *
 * @date 2013-7-5
 *
 */
public class MenuItem {
	
	private Menu owner;
	private String name;
	private String url;
	private Boolean currentMenuItem;
	
	public Menu getOwner() {
		return owner;
	}

	public void setOwner(Menu owner) {
		this.owner = owner;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}
	
	public Boolean getCurrentMenuItem(){
		if(this.getOwner()!=null){
			this.currentMenuItem=this.equals(this.getOwner().getCurrentMenuItem());
		}
		return this.currentMenuItem;
	}

	@Override
	public boolean equals(Object obj) {
		return EqualsBuilder.reflectionEquals(this, obj);
	}
	
	@Override
	public int hashCode() {
		return HashCodeBuilder.reflectionHashCode(this);
	}
	
	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
}
